<?php


namespace app\api\validate;


class IDCollection extends BaseValidate
{
    protected $rule = [
      'ids' => "require|checkIDs"
    ];

    protected $message = [
        'ids' => 'ids必须是用,分隔的正整数'
    ];

    protected function checkIDs($value) {
        $array = explode(',', $value);
        if (empty($array)) {
            return false;
        }
        foreach ($array as $id) {
            if (!$this->isInterger($id)) {
                return false;
            }
       }
        return true;
    }

}